/*     */ package com.yc.web;
/*     */ 
/*     */ import com.yc.dao.model.FileBO;
/*     */ import com.yc.dao.model.FolderBO;
/*     */ import com.yc.service.FolderService;
/*     */ import com.yc.util.ExtTreeNode;
/*     */ import com.yc.util.ListContentsBFO;
/*     */ import java.io.PrintStream;
/*     */ import java.util.ArrayList;
/*     */ import java.util.Date;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import org.apache.commons.logging.Log;
/*     */ import org.apache.commons.logging.LogFactory;
/*     */ 
/*     */ public class FolderBeb
/*     */ {
/*  20 */   private static final Log log = LogFactory.getLog(FolderBeb.class);
/*     */   private FolderService folderService;
/*     */ 
/*     */   public FolderBeb()
/*     */   {
/*  25 */     this.folderService = new FolderService();
/*     */   }
/*     */ 
/*     */   public boolean createFolder(FolderBO folderBo)
/*     */   {
/*  30 */     log.info("********创建文件夹【开始】************");
/*  31 */     boolean flag = true;
/*     */     try
/*     */     {
/*  34 */       if ("".equalsIgnoreCase(folderBo.getFolderId()))
/*     */       {
/*  36 */         folderBo.setFolderId(this.folderService.queryMaxFolderID());
/*  37 */         folderBo.setDepth(Integer.valueOf("1"));
/*  38 */         folderBo.setCreateTime(new Date());
/*  39 */         this.folderService.createFolder(folderBo);
/*     */       } else {
/*  41 */         this.folderService.updateFolderName(folderBo);
/*     */       }
/*     */     } catch (Exception e) {
/*  44 */       flag = false;
/*  45 */       e.printStackTrace();
/*     */     }
/*  47 */     log.info("********创建文件夹 【结束】" + flag + "************");
/*  48 */     return flag;
/*     */   }
/*     */ 
/*     */   public boolean createComFolder(FolderBO folderBo)
/*     */   {
/*  54 */     log.info("********创建文件夹【开始】************");
/*  55 */     boolean flag = true;
/*     */     try
/*     */     {
/*  58 */       if ("".equalsIgnoreCase(folderBo.getFolderId()))
/*     */       {
/*  60 */         folderBo.setFolderId(this.folderService.queryMaxFolderID());
/*  61 */         folderBo.setDepth(Integer.valueOf("1"));
/*  62 */         folderBo.setCreateTime(new Date());
/*  63 */         this.folderService.createComFolder(folderBo);
/*     */       } else {
/*  65 */         this.folderService.updateFolderName(folderBo);
/*     */       }
/*     */     } catch (Exception e) {
/*  68 */       flag = false;
/*  69 */       e.printStackTrace();
/*     */     }
/*  71 */     log.info("********创建文件夹 【结束】" + flag + "************");
/*  72 */     return flag;
/*     */   }
/*     */ 
/*     */   public ListContentsBFO getContents(Map condition)
/*     */   {
/*  78 */     ListContentsBFO bfo = new ListContentsBFO();
/*     */ 
/*  80 */     List resultList = new ArrayList();
/*  81 */     int start = Integer.parseInt(condition.get("start").toString());
/*  82 */     int limit = Integer.parseInt(condition.get("limit").toString());
/*  83 */     Object queryObj = condition.get("query");
/*  84 */     if (queryObj != null)
/*  85 */       log.info("******** [" + queryObj.toString() + "]");
/*  86 */     String strId = condition.get("id").toString();
/*  87 */     log.info(" strId = [" + strId + "] || start = [" + start + "]  ||  limit = [" + limit + "]");
/*  88 */     if ((strId == null) || ("".equals(strId.trim())))
/*     */     {
/*  90 */       bfo.setData(resultList.toArray());
/*  91 */       bfo.setTotalSize(0);
/*  92 */       return bfo;
/*     */     }
/*  94 */     bfo = this.folderService.getContents(condition);
/*  95 */     return bfo;
/*     */   }
/*     */ 
/*     */   public ListContentsBFO getComContents(Map condition)
/*     */   {
/* 101 */     ListContentsBFO bfo = new ListContentsBFO();
/*     */ 
/* 103 */     List resultList = new ArrayList();
/* 104 */     int start = Integer.parseInt(condition.get("start").toString());
/* 105 */     int limit = Integer.parseInt(condition.get("limit").toString());
/* 106 */     Object queryObj = condition.get("query");
/* 107 */     if (queryObj != null)
/* 108 */       log.info("******** [" + queryObj.toString() + "]");
/* 109 */     String strId = condition.get("id").toString();
/* 110 */     log.info(" strId = [" + strId + "] || start = [" + start + "]  ||  limit = [" + limit + "]");
/* 111 */     if ((strId == null) || ("".equals(strId.trim())))
/*     */     {
/* 113 */       bfo.setData(resultList.toArray());
/* 114 */       bfo.setTotalSize(0);
/* 115 */       return bfo;
/*     */     }
/* 117 */     bfo = this.folderService.getComContents(condition);
/* 118 */     return bfo;
/*     */   }
/*     */ 
/*     */   public ExtTreeNode[] getFolders(String strParendId, Map condition)
/*     */   {
/* 129 */     System.out.println("strParendId = " + strParendId);
/* 130 */     String strUserID = condition.get("strUserID").toString();
/* 131 */     String strDepth = condition.get("strDepth").toString();
/* 132 */     List list = this.folderService.findByUserId(strUserID, strParendId, strDepth);
/* 133 */     ExtTreeNode[] treeNode = new ExtTreeNode[list.size()];
/* 134 */     list.toArray(treeNode);
/* 135 */     return treeNode;
/*     */   }
/*     */ 
/*     */   public ExtTreeNode[] getComFolders(String strParendId, Map condition)
/*     */   {
/* 147 */     log.info("strParendId = " + strParendId);
/* 148 */     String strUserID = condition.get("strUserID").toString();
/* 149 */     String strDepth = condition.get("strDepth").toString();
/* 150 */     List list = this.folderService.findComFolder(strParendId);
/* 151 */     ExtTreeNode[] treeNode = new ExtTreeNode[list.size()];
/* 152 */     list.toArray(treeNode);
/* 153 */     return treeNode;
/*     */   }
/*     */ 
/*     */   public boolean deleteFolder(String strFolderID)
/*     */   {
/* 164 */     return this.folderService.deleteFolder(strFolderID);
/*     */   }
/*     */ 
/*     */   public boolean deleteFile(String strFileID)
/*     */   {
/* 174 */     return this.folderService.deleteFile(strFileID);
/*     */   }
/*     */ 
/*     */   public boolean setFileShare(FileBO bo)
/*     */   {
/* 184 */     return this.folderService.setFileShare(bo);
/*     */   }
/*     */ 
/*     */   public boolean updateFolderName(FolderBO bo)
/*     */   {
/* 193 */     return this.folderService.updateFolderName(bo);
/*     */   }
/*     */ 
/*     */   public boolean editFileName(FileBO bo)
/*     */   {
/* 198 */     return this.folderService.editFileName(bo);
/*     */   }
/*     */ 
/*     */   public boolean isFileExists(String strFolderID, String strFileName)
/*     */   {
/* 203 */     return this.folderService.isFile(strFolderID, strFileName);
/*     */   }
/*     */ }

/* Location:           E:\java\apache-tomcat-6.0.36\webapps\btsm\WEB-INF\classes\
 * Qualified Name:     com.yc.web.FolderBeb
 * JD-Core Version:    0.6.2
 */